<template>
 <!-- antd 国际化 LocalProvider -->
  <a-config-provider :locale="locale">
    <div id="app">
      <router-view/>
    </div>
  </a-config-provider>
</template>
<script>
  import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN';
  import moment from 'moment';
  import enquireScreen from './utils/device'
  import 'moment/locale/zh-cn';
  import {DEVICE_TYPE} from './store/mutation-types'

  moment.locale('zh-cn');
  export default {
    data () {
      return {
        locale: zh_CN,
      }
    },
    created () {
      let that = this
      // 屏幕尺寸改变时设置模式
      enquireScreen(deviceType => {
        // 侧边菜单转换为图标(mobile模式)
        // tablet
        if (deviceType === 0) {
          that.$store.commit('TOGGLE_DEVICE', DEVICE_TYPE.flat)
          that.$store.dispatch('setSidebar', false)
        }
        // mobile
        else if (deviceType === 1) {
          that.$store.commit('TOGGLE_DEVICE', DEVICE_TYPE.mobile)
          that.$store.dispatch('setSidebar', true)
        }
        // 侧边菜单转换为文字+图标(电脑模式)
        else {
          that.$store.commit('TOGGLE_DEVICE', DEVICE_TYPE.desktop)
          that.$store.dispatch('setSidebar', true)
        }

      })
    }
  }
</script>
<style>
  #app {
    height: 100%;
    /* min-width: 1220px; */
  }
</style>